package com.mcxx.modules.miniSalvation.fundpay.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class CareObjectFundPayExcelDTO extends BaseExcelEntity implements Serializable {

    private static final long serialVersionUID = -1;


    @Excel(name = "街道", width = 20)
    private String areaCode;

    @Excel(name = "社区", width = 20)
    private String countyCode;


    @Excel(name = "姓名", width = 10)
    private String name;


    @Excel(name = "身份证号码", width = 20)
    private String idcard;


    @Excel(name = "发放金额", width = 14)
    private String fundNumber;


    @Excel(name = "保障人数", width = 10)
    private String personNumber;


    @Excel(name = "护理类型", width = 10, dict = "GrantObject", isColumnHidden = true)
    private String nurseType;


    @Excel(name = "照料人姓名/机构名称", width = 20)
    private String recevier;

    @Excel(name = "照料人身份证/机构信用代码", width = 20)
    private String recevierIdcard;

    public static List<CareObjectFundPayExcelDTO> convertExcelDTO(List<FundPayMemberDTO> list) {
        List<CareObjectFundPayExcelDTO> results = new ArrayList<>();
        for (FundPayMemberDTO obj : list) {
            CareObjectFundPayExcelDTO target = new CareObjectFundPayExcelDTO();
            BeanUtils.copyProperties(obj,target);
            String fundNumber = obj.getFundNumber() == null ? "0" : String.valueOf(obj.getFundNumber());
            target.setFundNumber(fundNumber);
            String personNumber = obj.getPersonNumber() == null ? "0" : String.valueOf(obj.getPersonNumber());
            target.setPersonNumber(personNumber);
            results.add(target);
        }
        return results;
    }
}
